const puppeteer = require('puppeteer');


(async () => {
    const browser = await puppeteer.launch({
        "headless": true,
        "args": [
            "--disable-gpu",
            "--disable-dev-shm-usage",
            "--disable-setuid-sandbox",
            "--no-first-run",
            "--no-sandbox",
            "--no-zygote",
            "--disable-extensions"
        ],
        "ignoreHTTPSErrors": true,
        "defaultViewport": {
            "width": 1010,
            "height": 800
        },
        "devtools": false,
        "userDataDir": "./cache"
    });
    const page = await browser.newPage();

    page.on('console',(c) => {console.log(c.text())});

    await page.goto('http://slide.aixuexi.com/player.html?deck=0e0f85c1-3410-47f9-a0a3-91f73e2038e1&screenshot=true&slideNum=28',{
        "timeout": 1200000,
        "waitUntil": "networkidle0"
    });

    await page.screenshot({path: `./tmp/example${new Date().getTime().toString()}.png`});
  
    await browser.close();

    console.log('截图完成');
  })();